﻿namespace JxcLite.Pages.Finance;

class AccountForm : BaseTabForm
{
    [Parameter] public FormModel<JxAccountHead> Model { get; set; }

    protected override async Task OnInitFormAsync()
    {
        await base.OnInitFormAsync();
        Tab.AddTab("表头信息", BuildHead);
        Tab.AddTab("对账明细", BuildList);
        Tab.Right = b => b.Tag(Model.Data.Status);
    }

    private void BuildHead(RenderTreeBuilder builder)
    {
        builder.Component<AccountHead>().Set(c => c.Model, Model).Build();
    }

    private void BuildList(RenderTreeBuilder builder)
    {
        builder.Component<BillHeadTable>()
               .Set(c => c.ReadOnly, Model.IsView)
               .Set(c => c.Account, Model.Data)
               .Build();
    }
}